package com.peanut.baby.widget.citypicker.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

public class CityBean implements Parcelable {

    private String name;


    private ArrayList<DistrictBean> children;

    @Override
    public String toString() {
        return name;
    }


    public String getName() {
        return name == null ? "" : name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ArrayList<DistrictBean> getCityList() {
        return children;
    }

    public void setCityList(ArrayList<DistrictBean> cityList) {
        this.children = cityList;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeTypedList(this.children);
    }

    public CityBean() {
    }

    protected CityBean(Parcel in) {
        this.name = in.readString();
        this.children = in.createTypedArrayList(DistrictBean.CREATOR);
    }

    public static final Creator<CityBean> CREATOR = new Creator<CityBean>() {
        @Override
        public CityBean createFromParcel(Parcel source) {
            return new CityBean(source);
        }

        @Override
        public CityBean[] newArray(int size) {
            return new CityBean[size];
        }
    };
}
